package cn.wen.javax.servlet.jsp.tagext.builder.base;

import java.io.IOException;

import javax.servlet.jsp.JspWriter;

import org.apache.log4j.Logger;

import com.opensymphony.xwork2.util.ValueStack;

import cn.wen.javax.servlet.jsp.tagext.AbstractTag;

public abstract class AbstractBuilder implements IBuilder {

    public AbstractBuilder(AbstractTag tag) {
	super();
	this.tag = tag;
	this.valueStack = tag.getValueStack();
    }

    public AbstractBuilder() {
	super();
    }

    private final Logger log = Logger.getLogger(getClass());

    protected StringBuilder context = new StringBuilder();

    protected ValueStack valueStack;

    protected AbstractTag tag;

    @Override
    public void render(JspWriter out) {
	String html = context.toString();
	try {
	    out.write(html);
	}
	catch (IOException e) {
	    log.error(e.getMessage(), e);
	}
    }

}
